﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Dimok;

namespace Dimok.Web.UI.DSs {
	[Serializable]
	public class Dimension {
		public int x = 0;
		public int y = 0;
		public int w = 0;
		public int h = 0;
		public Dimension() { }
		public Dimension(string XYWH) {
			x = y = w = h = 0;
			var a = (XYWH+"").Split(',').Where(s=>s!="").ToArray();
			if (a.Length == 0) return;
			x = int.Parse(a[0]);
			y = int.Parse(a[1]);
			w = int.Parse(a[2]);
			h = int.Parse(a[3]);
		}
		public Dimension(int X, int Y, int W, int H) {
			x = X; y = Y; w = W; h = H;
		}
		public static implicit operator string(Dimension d) { return d.x + "," + d.y + "," + d.w + "," + d.h; }
	}
}
